const { FusesPlugin } = require("@electron-forge/plugin-fuses");
const { FuseV1Options, FuseVersion } = require("@electron/fuses");
const path = require("path");

// 先定义图标路径变量，方便维护和检查
module.exports = {
  packagerConfig: {
    name: "IDPS",
    asar: true,
    tmpdir: path.resolve("D:/my-electron-temp"),
    icon: './src/icons/icon', 
  },
  rebuildConfig: {},
  makers: [
    // exe安装包
    {
      name: "@electron-forge/maker-squirrel",
      config: {
        name: "IDPS",
        requireAdmin: false, // 无需管理员权限（避免权限冗余）
        setupIcon: './src/icons/demo.ico'
      },
    },
    // msi 安装包
    {
      name: "@electron-forge/maker-wix",
      config:{
        name: "IDPS", // 安装包名称
        description: "IDPS", // 应用描述
        manufacturer: "IDPS", // 制造商名称
        version: "1.0.1", // 版本号（需与 packagerConfig 一致）
        icon: './src/icons/icon.ico', 
      }
    },
    {
      name: "@electron-forge/maker-zip",
      platforms: ["darwin"],
    },
    {
      name: "@electron-forge/maker-deb",
      config: {},
    },
    {
      name: "@electron-forge/maker-rpm",
      config: {},
    },
  ],
  plugins: [
    {
      name: "@electron-forge/plugin-auto-unpack-natives",
      config: {},
    },
    // Fuses are used to enable/disable various Electron functionality
    // at package time, before code signing the application
    new FusesPlugin({
      version: FuseVersion.V1,
      [FuseV1Options.RunAsNode]: false,
      [FuseV1Options.EnableCookieEncryption]: true,
      [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
      [FuseV1Options.EnableNodeCliInspectArguments]: false,
      [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
      [FuseV1Options.OnlyLoadAppFromAsar]: true,
    }),
  ],
};
